package com.zuxia.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zuxia.dto.OrderToDto;
import com.zuxia.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author laoli
 * @since 2024-11-18
 */
@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {
    @Select("select sum(shop_num) from orders where orders_status=1 or orders_status=0 group by order_id having order_id=#{orderId}")
    int getOrdersShopNumById(@Param("orderId") String orderId);
    @Select("select sum(shop_num) from orders where orders_status=1 and  order_id=#{orderId} group by order_id")
    int getOrdersShopSusseceNumBy(@Param("orderId") String orderId);
    @Select("${sql}")
    IPage<OrderToDto> getOrdersPageList(IPage page,@Param("sql") String sql);
}
